package com.gnrsoft.springboot_test.commons.mq;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.aliyun.openservices.ons.api.order.OrderProducer;

/**
 *  rocketmq 配置类
 *
 */
@Configuration
public class MqConfig {

	@Value("${mq.producerid}")
	private String producerId;

	@Value("${mq.accesskey}")
	private String accessKey;

	@Value("${mq.secretkey}")
	private String secretKey;

	@Value("${mq.addr}")
	private String addr;

	@Bean
	public OrderProducer createOrderProducer() {
		/*Properties properties = new Properties();
		properties.setProperty(PropertyKeyConst.ProducerId, producerId);
		properties.setProperty(PropertyKeyConst.AccessKey, accessKey);
		properties.setProperty(PropertyKeyConst.SecretKey, secretKey);
		properties.setProperty(PropertyKeyConst.ONSAddr, addr);

		OrderProducer producer = ONSFactory.createOrderProducer(properties);
		// 在发送消息前，必须调用 start 方法来启动 Producer，只需调用一次即可。
		producer.start();
		return producer;*/
		return null;
	}

}
